package com.bblocks.enums;

import lombok.Getter;

/**
 * 支付订单状态
 * Created by wangdj
 */
@Getter
public enum OrderStatusEnum {

    SUCCESS("支付成功"), //最终状态

    REFUND("转入退款"),
	REFUND_SUC("退款成功"),

    NOTPAY("未支付"),

    CLOSED("已关闭"), //最终状态

    REVOKED("已撤销（刷卡支付）"),

    USERPAYING("用户支付中"),

    PAYERROR("支付失败"), //最终状态

    UNKNOW("未知状态"),
    
    REPEAT("支付重复")
    ;

    /**
     * 描述 微信退款后有内容
     */
    private String desc;

    OrderStatusEnum(String desc) {
        this.desc = desc;
    }

    private static OrderStatusEnum[] all =  OrderStatusEnum.values();
    public static OrderStatusEnum findByName(String name) {
        for (OrderStatusEnum orderStatusEnum : all) {
            if (name.toLowerCase().equals(orderStatusEnum.name().toLowerCase())) {
                return orderStatusEnum;
            }
        }
        throw new RuntimeException("错误的支付状态");
    }

    public String toString(){
        return this.name();
    }
}
